package com.hu.vo;

import com.hu.pojo.University;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author ZhouKai
 * 2022/4/20 16:38
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UniversityVo {
    /**
     * 院校代码
     */
    private Integer id;
    /**
     * 院校名称
     */
    private String schoolName;
    /**
     * 校训
     */
    private String schoolMotto;
    /**
     * 校徽(文件路径)
     */
    private String schoolBadge;
    /**
     * 标签 (如 985工程) (用:分隔)
     */
    private String[] label;
    /**
     * 办学性质 (如 公办高校)
     */
    private String schoolNature;
    /**
     * 院校类型 (如 综合类，农林类等)
     */
    private String schoolType;
    /**
     * 学校特色 (如 双一流) (用:分隔)
     */
    private String[] schoolCharacteristics;
    /**
     * 地址 (用#分隔)
     */
    private String[] schoolAddress;
    /**
     * 创建时间
     */
    private String foundingTime;
    /**
     * 院校简介
     */
    private String schoolProfile;

    /**
     * 构造方法，将University转换为UniversityVo
     * @param university 院校信息
     */
    public UniversityVo(University university) {
        this.id=university.getId();
        this.schoolName=university.getSchoolName();
        this.schoolMotto=university.getSchoolMotto();
        this.schoolBadge=university.getSchoolBadge();
        this.label=university.getLabel().split(":");
        this.schoolNature= university.getSchoolNature();
        this.schoolType=university.getSchoolType();
        this.schoolCharacteristics=university.getSchoolCharacteristics().split(":");
        this.schoolAddress=university.getSchoolAddress().split("#");
        this.foundingTime=university.getFoundingTime();
        this.schoolProfile=university.getSchoolProfile();
    }
}
